package com.yelink.metrics.cases.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yelink.metrics.cases.config.MyModelType;
import com.yelink.metrics.core.constant.annotations.MetricsColumn;
import com.yelink.metrics.core.constant.annotations.MetricsInfo;
import com.yelink.metrics.core.constant.enums.FieldDefine;
import com.yelink.metrics.core.constant.enums.TimeDimension;
import com.yelink.metrics.core.domain.BaseMetricsEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;

/**
 * 示例模板
 * {@link MetricsInfo} 指标表相关信息
 * @author idea
 */
@Data
@Builder
@ToString
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@MetricsInfo(comment = "demo-每日统计", modelEnum = MyModelType.class, modelCode = "metricsSdkTarget")
@TableName(value = "metrics_demo_daily", schema = "dfs_metrics")
public class DemoDailyEntity extends BaseMetricsEntity {

    /**
     * {@link MetricsColumn} 指标字段相关信息： 字段定义为维度或时间维度时需要明确的标注出来； 当为时间维度时，需要标记
     */
    @MetricsColumn(comment = "指标中文名", remark = "更多说明?", filedDefine = FieldDefine.DIMENSION)
    @TableField(value = "demo")
    private String demo;

    /**
     * {@link MetricsColumn} 指标字段相关信息：当为时间维度时，需要标记 timeEnum
     */
    @MetricsColumn(comment = "记录日期", filedDefine = FieldDefine.TIME_DIMENSION, timeEnum = TimeDimension.DAY)
    @TableField(value = "record_time")
    private Date recordTime;


    @MetricsColumn(comment = "电压值", remark = "指标值的计算公式", filedDefine = FieldDefine.TARGET)
    @TableField(value = "ia_val")
    private Double iaVal;

    @MetricsColumn(comment = "说明", remark = "这是一个说明书", filedDefine = FieldDefine.ATTACHMENT)
    @TableField(value = "description")
    private String description;

    //CREATE TABLE `metrics_demo_daily` (
    //  `id` int NOT NULL AUTO_INCREMENT,
    //  `demo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '指标中文名 [更多说明?]',
    //  `record_time` date DEFAULT NULL COMMENT '记录日期 [yyyy-MM-dd]',
    //  `uni_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '唯一索引',
    //  `time` datetime DEFAULT NULL COMMENT '最近更新时间',
    //  `ia_val` double(16,4) DEFAULT NULL COMMENT '电压值 [指标值的计算公式]',
    //  `description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '说明 [这是一个说明书]',
    //  PRIMARY KEY (`id`),
    //  UNIQUE KEY `idx_uni` (`uni_code`) USING BTREE,
    //  KEY `idx_number` (`number`),
    //  KEY `idx_record_time` (`record_time`)
    //) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='demo-每日统计';
}
